package com.hongkang.springtrains.service.impl;

import com.hongkang.springtrains.model.User;
import com.hongkang.springtrains.repository.UserRepository;
import com.hongkang.springtrains.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserRepository repository;

    @Override
    public User getUserByName(String name) {
        return repository.findByName(name);
    }

    @Override
    public Long getUserCount() {
        return repository.count();
    }

    @Override
    public List<User> getAllUser() {
        return repository.findAll();
    }
}
